package com.woniu.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniu.entity.dto.TrainingInfoDTO;
import com.woniu.entity.vo.TrainingInfoVO;
import com.woniu.entity.vo.TrainingVO;
import com.woniu.pojo.TrainingInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaosong
 * @since 2023-03-31
 */
@Mapper
public interface TrainingInfoMapper extends BaseMapper<TrainingInfo> {

    IPage<TrainingInfoVO> selectall(IPage<TrainingInfoVO> page,@Param("trainingDto") TrainingInfoDTO trainingDto);

    @Select("select t.price, t.difficulty,t.avatar,info.tags,info.answer from wnsys_training t inner join wnsys_training_info info on t.id = info.training_id where " +
            "t.id = #{trainingId}")
    @ResultType(TrainingVO.class)
    TrainingVO selectInformation(Integer trainingId);
}
